<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <title>v-model案例</title>
</head>

<body>
    <div id="app">
        <runoob-input v-model="num"></runoob-input>
        <p>这是{{num}}</p>
    </div>
    <script>
        Vue.component('runoob-input', {
            template: `
            <p><!-- 包含了名为 input 的事件 -->
            <input
            ref="input"
            :value="value"
            @input="$emit('input', $event.target.value)"
            >
            </p>
            `,
            props: ['value'], // 名为 value 的 prop

        })
        var a = new Vue({
            el: '#app',
            data: {
                num: 100,

            }
        })
    </script>
</body>

</html>